package com.zlyx.easy.core.utils;

/**
 * @Auth 赵光
 * @Describle
 * @2019年5月11日 下午3:10:59
 */
public final class ThreadUtils {

	/**
	 * 将Runnable接口转换为Thread
	 * 
	 * @param runnable
	 * @return
	 */
	public static Thread convert(Runnable runnable) {
		return new Thread(runnable);
	}

	/**
	 * 休眠当前线程
	 * 
	 * @param millis
	 */
	@SuppressWarnings("static-access")
	public static void sleep(int millis) {
		try {
			Thread.currentThread().sleep(millis);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	/**
	 * 线程哈希码
	 * 
	 * @return
	 */
	public static int getCurrentThreadCode() {
		return Thread.currentThread().hashCode();
	}
}
